home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / misc1 / iv26_w30.zip / EXAMPLES / IDRAW / STATEVIE.H < prev    next >
C/C++ Source or Header  |  1980-01-05  |  4KB  |  181 lines

  1. /*
  2.  * Copyright (c) 1987, 1988, 1989 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and its
  5.  * documentation for any purpose is hereby granted without fee, provided
  6.  * that the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name of Stanford not be used in advertising or
  9.  * publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.  Stanford makes no representations about
  11.  * the suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  15.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  17.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  18.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  19.  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  20.  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21.  */
  22.  
  23. // $Header: stateviews.h,v 1.9 89/10/09 14:49:56 linton Exp $
  24. // declares classes StateView and StateView's subclasses.
  25.  
  26. #ifndef stateviews_h
  27. #define stateviews_h
  28.  
  29. #include <InterViews/interactor.h>
  30.  
  31. // Declare imported types.
  32.  
  33. class Graphic;
  34. class State;
  35.  
  36. // A StateView attaches itself to a State and displays some of the
  37. // State's information.
  38.  
  39. class StateView : public Interactor {
  40. public:
  41.  
  42.     StateView(State*, const char*);
  43.     ~StateView();
  44.  
  45. protected:
  46.  
  47.     void Reconfig();
  48.     void Redraw(Coord, Coord, Coord, Coord);
  49.     void Resize();
  50.  
  51.     State* state;        // stores subject whose attribute view displays
  52.     char* label;        // stores view's text label
  53.  
  54.     Coord label_x, label_y;    // stores position at which to display label
  55.  
  56. };
  57.  
  58. // A BrushView displays the current brush.
  59.  
  60. class BrushView : public StateView {
  61. public:
  62.  
  63.     BrushView(State*);
  64.     ~BrushView();
  65.  
  66.     void Update();
  67.  
  68. protected:
  69.  
  70.     void Reconfig();
  71.     void Redraw(Coord, Coord, Coord, Coord);
  72.     void Resize();
  73.  
  74.     Graphic* brushindic;    // displays line to demonstrate brush's effect
  75.  
  76. };
  77.  
  78. // A DrawingNameView displays the drawing's name.
  79.  
  80. class DrawingNameView : public StateView {
  81. public:
  82.  
  83.     DrawingNameView(State*);
  84.  
  85.     void Update();
  86.  
  87. protected:
  88.  
  89.     void Reconfig();
  90.     void Resize();
  91.     const char* GetDrawingName(State*);
  92.  
  93. };
  94.  
  95. // A FontView displays the current font.
  96.  
  97. class FontView : public StateView {
  98. public:
  99.  
  100.     FontView(State*);
  101.     ~FontView();
  102.  
  103.     void Update();
  104.  
  105. protected:
  106.  
  107.     void Reconfig();
  108.     void Redraw(Coord, Coord, Coord, Coord);
  109.     const char* GetPrintFontAndSize(State*);
  110.  
  111.     Painter* background;        // draws background behind label
  112.  
  113. };
  114.  
  115. // A GriddingView displays the current status of the grid's gridding.
  116.  
  117. class GriddingView : public StateView {
  118. public:
  119.  
  120.     GriddingView(State*);
  121.  
  122.     void Update();
  123.  
  124. protected:
  125.  
  126.     const char* GetGridding(State*);
  127.  
  128. };
  129.  
  130. // A MagnifView displays the current magnification.
  131.  
  132. class MagnifView : public StateView {
  133. public:
  134.  
  135.     MagnifView(State*, Interactor*);
  136.  
  137.     void Update();
  138.  
  139. protected:
  140.  
  141.     void Resize();
  142.     const char* GetMagnif(State*);
  143.  
  144. };
  145.  
  146. // A ModifStatusView displays the current modification status.
  147.  
  148. class ModifStatusView : public StateView {
  149. public:
  150.  
  151.     ModifStatusView(State*);
  152.  
  153.     void Update();
  154.  
  155. protected:
  156.  
  157.     const char* GetModifStatus(State*);
  158.  
  159. };
  160.  
  161. // A PatternView displays the current pattern.
  162.  
  163. class PatternView : public StateView {
  164. public:
  165.  
  166.     PatternView(State*);
  167.     ~PatternView();
  168.  
  169.     void Update();
  170.  
  171. protected:
  172.  
  173.     void Reconfig();
  174.     void Redraw(Coord, Coord, Coord, Coord);
  175.  
  176.     Painter* patindic;        // fills rect to demonstrate pat's effect
  177.  
  178. };
  179.  
  180. #endif
  181.